/**
 * @Author       : xiangmin
 * @File         : 获取下拉框等选项
 * @Date         : 2024-12-18 19:48:16
 * @LastEditors  : xiangmin
 * @LastEditTime : 2024-12-18 19:48:18
 */

import { ref } from 'vue'

export default function (query) {
    const loading = ref(false)
    const options = ref([])

    async function getOptions() {
        loading.value = true
        options.value = await query()
        loading.value = false
    }

    if (query) {
        getOptions()
    }

    return {
        loading,
        options
    }
}
